<style scoped>
  .weui-media-box_appmsg .weui-media-box__hd {
    font-size: 12px;
    /*background: #ccc;*/
    color: #fff;
  }
  .weui-media-box_appmsg .weui-media-box__hd .blue {
    background: #296BCC !important;
  }
  .weui-media-box__desc {
    font-size: 12px;
  }
  .weui-media-box__title {
    white-space: normal;
    font-size: 14px;
    margin-bottom: 5px;
  }
  .weui-form-preview__bd {
    text-align: left;
  }

  .weui-form-preview {
    position: relative;
    background-color: #fff;
    margin: 1%;
    border-radius: 5px;
  }
  .time {
    position: absolute;
    right: 15px;
    top: 0;
    font-size: 10px;
    color: #ccc;
  }

  .logimg {
    width: 14px;
    height: 14px;
  }
  .datalist {
    background: #e3e3e3;
    height: 100%;
    overflow: hidden;
  }
  .datalist.nodata {
    font-size: 14px;
    padding: 5px;
  }
  .weui-media-box_appmsg {
    /*display: block !important;*/
    font-size: 0;
    align-items: end;
  }
  .weui-media-box_appmsg .weui-media-box__hd {
    margin-right: 5% !important;
    /*width: 23%;*/
    height: 23%;
    white-space: nowrap;
    /*line-height: 23%;*/
    display: inline-block !important;
  }
  .weui-media-box_appmsg .weui-media-box__bd {
    display: inline-block !important;
    width: 71%;
  }
  .weui-media-box__desc {
    overflow: initial;
    line-height: 1.4;
    display: flex;
  }
  .weui-media-box_appmsg .weui-media-box__hd .nodenm{
    width: 50px;
    height: 50px;
    line-height: 50px;
    border-radius: 50%;
    background: #ccc;
    margin: 0 auto;
  }
  .weui-media-box {
    padding: 0 !important;
    /*margin: 2px 0;*/
  }

  .delsty {
    position: absolute;
    top: -7px;
    right: -11px;
    /*z-index: 1000;*/
  }
  .icontbox {
    font-size: 0;display: flex;
  }
  .contbox-h4 {
    width: 50%;display: inline-block;
  }
  .contbox-txt {
    width: 50%; display: inline-block;font-size: 10px; color: #ccc;
  }
  .weui_uploader_input_wrp {
    float: left;
    position: relative;
    margin-right: 9px;
    margin-bottom: 9px;
    width: 77px;
    height: 77px;
    border: 1px solid #D9D9D9;
  }
  .weui_uploader_files {
    list-style: none;
  }

  .weui_uploader_input_wrp:before {
    width: 2px;
    height: 39.5px;
  }

  .weui_uploader_input_wrp:before, .weui_uploader_input_wrp:after {
    content: " ";
    position: absolute;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    background-color: #D9D9D9;
  }

  .weui_uploader_input {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  }

  .weui_uploader_input_wrp:after {
    width: 39.5px;
    height: 2px;
  }

  .weui_uploader_bd {
    overflow: hidden;
  }
  .outstore >>> .weui-uploader_file {
    float: left;
    margin-right: 9px;
    margin-bottom: 9px;
    width: 79px;
    background: no-repeat 50%;
    background-size: cover;
  }

  .weui-cell.fir {
    border-top: 0;
  }

  .weui_uploader_input_wrp.inrow {
    width: 30px;
    height: 30px;
    margin: 0;
  }

  .weui_uploader_input_wrp:before {
    height: 19.5px;
  }

  .weui_uploader_input_wrp:after {
    width: 19.5px;
  }

  .weui-uploader_file.inrow {
    margin: 0;
    width: 40px;
  }

  li.weui-uploader_file {
    display: inline-block;
    padding: 3px 5px;
  }
  .weui-cells:after, .weui-cells:before {
    height: 0;
  }
  .weui-cells:before {
    border-top: 0;
  }
  .weui-media-box_appmsg .weui-media-box__hd .nodenm {
    margin: initial;
  }

  .weui-cell__ft .contbox-h4 {
    width: auto;
  }
  .weui-cell__ft .nodenm {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
  }
  .weui-cell__ft .delsty {
    top: 0;
    right: 0;
  }
  .weui-cell_swiped>.weui-cell__ft {
    width: 100%;
  }
  .weui-cell__ft .weui-media-box {
    width: 100%;
  }
  .weui-media-box_appmsg .weui-media-box__hd.anode {
    margin-right: 0 !important;
  }
  .weui-swiped-btn {
    color: inherit;
    display: flex;
    width: 10%;
    text-align: center;
    height: auto;
    font-size: 10px;
    align-items: center;
    justify-content: center;
    padding: 2px;
  }
  .weui-cells {
    margin: 2px 0;
  }
  .weui-cells:after {
    border-bottom: 0;
  }

  .muti1 .weui-form-preview__bd {
    margin-left: 20px;
  }

  .paylayer {
    width: 100%;
    text-align: center;
    position: fixed;
    bottom: 0;
    border-top: 1px solid #ddd;
    background: #fff;
    z-index: 100;
    box-shadow: 0 0 5px #999;
  }
</style>
<template>
  <div class="logs">
    <div class="rj-wrap">
      审批记录
      <a href="javascript:;" @click="$router.back(-1)" style="position: absolute; left: 10px; top: 8px">
        <img src="@/assets/back.png" style="width: 20px" />
      </a>
    </div>

    <div style="overflow:auto;overflow-x: hidden;padding-bottom: 40px;" v-show="nodes.length > 0" id="wrap">
      <template v-for="(item, index) in nodes">
        <!--2345-->
        <template v-if="isArray(item)">

            <div class="weui-form-preview muti1">
              <div class="weui-form-preview__bd">
                    <template v-if="item.length > 1">
                      <div class="weui-cells">
                        <div class="weui-cell weui-cell_swiped">
                          <div class="weui-cell__bd" style="transform: translate3d(0px, 0px, 0px);">
                            <a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">
                              <template v-for="(item2, index2) in item">
                                <template v-if="isArray(item2)">

<!--                                  <div class="weui-cells" style="margin-top: 60px;">-->
                                  <div class="weui-cells">
                                    <div class="weui-cell weui-cell_swiped">
                                      <div class="weui-cell__bd" style="transform: translate3d(0px, 0px, 0px);">
                                        <a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">
                                          <template v-for="(item3, index3) in item2">
                                            <template v-if="isArray(item3)">

                                            </template>
                                            <template v-else>
                                              <div class="weui-media-box__hd anode" style="overflow: hidden;">
                                                <div class="nodenm" @click="openNode(item3)" :class="item3.status != 1 ? 'blue' : ''">{{item3.name}}</div>
                                              </div>
                                            </template>
                                          </template>
                                        </a>
                                      </div>
                                      <div class="weui-cell__ft ahnode">
                                        <!--                <a class="weui-swiped-btn weui-swiped-btn_warn delete-swipeout" href="javascript:">删除</a>-->
                                        <a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">
                                          <div class="weui-media-box__hd" style="overflow: hidden;">
                                            <div class="nodenm"  :class="currNode.status != 1 ? 'blue' : ''">{{currNode.name}}</div>
                                          </div>
                                          <div class="weui-media-box__bd" style="position: relative;">
                                            <div class="icontbox">
                                              <h4 class="weui-media-box__title contbox-h4">{{(itemOperators(currNode.operators).length > 0 ? itemOperators(currNode.operators)[0] : {}).realname}}</h4>
                                              <!--                                              <h4 class="weui-media-box__title contbox-h4" v-if="itemOperators(currNode.operators).length <= 1" v-for="(oper, i) in itemOperators(currNode.operators)">{{oper.realname}}</h4>-->
<!--                                              <h4 class="weui-media-box__title contbox-h4" v-if="itemOperators(currNode.operators).length > 1"><span v-for="(oper2, i) in itemOperators(currNode.operators)">{{oper2.realname}}<i v-show="i+1 != itemOperators(currNode.operators).length"> / </i></span></h4>-->
                                              <p class="contbox-txt">{{filterNull(currNode.logs).createtime}}</p>
                                            </div>
                                            <p class="weui-media-box__desc">{{filterNull(currNode.logs).description}}</p>
                                            <div class="exp uploaderFiles" style="display: inline-block;padding-top: 5px;" v-if="currNode.logs != null && getImgType(currNode.logs.imgs).length > 0">
                                              <img class="logimg" style="padding-right: 5px;"  v-for="(image, index) in getImgType(currNode.logs.imgs)" :key="image.guid"  alt="" onerror="javascript:this.src='../../../static/image/default.png';this.onerror = null" :src="image.url + '-suolue.png'" :data-img="image.url + '.png'" />
                                            </div>
                                          </div>
                                        </a>
                                        <a class="weui-swiped-btn weui-swiped-btn_default close-swipeout" href="javascript:">关闭</a>
                                      </div>
                                    </div>
                                  </div>
                                </template>
                                <template v-else>
                                  <div class="weui-media-box__hd anode" style="overflow: hidden;">
                                    <div class="nodenm" @click="openNode(item2)" :class="item2.status != 1 ? 'blue' : ''">{{item2.name}}</div>
                                  </div>
                                </template>
                              </template>
                            </a>
                          </div>
                          <div class="weui-cell__ft ahnode">
                            <!--                <a class="weui-swiped-btn weui-swiped-btn_warn delete-swipeout" href="javascript:">删除</a>-->
                            <a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">
                              <div class="weui-media-box__hd" style="overflow: hidden;">
                                <div class="nodenm"  :class="currNode.status != 1 ? 'blue' : ''">{{currNode.name}}</div>
                              </div>
                              <div class="weui-media-box__bd" style="position: relative;">
                                <div class="icontbox">
                                  <h4 class="weui-media-box__title contbox-h4">{{(itemOperators(currNode.operators).length > 0 ? itemOperators(currNode.operators)[0] : {}).realname}}</h4>
                                  <!--                                  <h4 class="weui-media-box__title contbox-h4" v-if="itemOperators(currNode.operators).length <= 1" v-for="(oper, i) in itemOperators(currNode.operators)">{{oper.realname}}</h4>-->
<!--                                  <h4 class="weui-media-box__title contbox-h4" v-if="itemOperators(currNode.operators).length > 1"><span v-for="(oper2, i) in itemOperators(currNode.operators)">{{oper2.realname}}<i v-show="i+1 != itemOperators(currNode.operators).length"> / </i></span></h4>-->
                                  <p class="contbox-txt">{{filterNull(currNode.logs).createtime}}</p>
                                </div>
                                <p class="weui-media-box__desc">{{filterNull(currNode.logs).description}}</p>
                                <div class="exp uploaderFiles" style="display: inline-block;padding-top: 5px;" v-if="currNode.logs != null && getImgType(currNode.logs.imgs).length > 0">
                                  <img class="logimg" style="padding-right: 5px;"  v-for="(image, index) in getImgType(currNode.logs.imgs)" :key="image.guid"  alt="" onerror="javascript:this.src='../../../static/image/default.png';this.onerror = null" :src="image.url + '-suolue.png'" :data-img="image.url + '.png'" />
                                </div>
                              </div>
                            </a>
                            <a class="weui-swiped-btn weui-swiped-btn_default close-swipeout" href="javascript:">关闭</a>
                          </div>
                        </div>
                      </div>
                    </template>
                    <template v-else>
                      <template v-for="(item2, index2) in item">
                        <a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">
                          <div class="weui-media-box__hd" style="overflow: hidden;">
                            <div class="nodenm"  :class="item2.status != 1 ? 'blue' : ''">{{item2.name}}</div>
                          </div>
                          <div class="weui-media-box__bd" style="position: relative;">
                            <div class="icontbox">
                              <h4 class="weui-media-box__title contbox-h4">{{(itemOperators(item2.operators).length > 0 ? itemOperators(item2.operators)[0] : {}).realname}}</h4>

<!--                              <h4 class="weui-media-box__title contbox-h4" v-if="itemOperators(item2.operators).length <= 1" v-for="(oper, i) in itemOperators(item2.operators)">{{oper.realname}}</h4>-->
<!--                              <h4 class="weui-media-box__title contbox-h4" v-if="itemOperators(item2.operators).length > 1"><span v-for="(oper2, i) in itemOperators(item2.operators)">{{oper2.realname}}<i v-show="i+1 != itemOperators(item2.operators).length"> / </i></span></h4>-->
                              <p class="contbox-txt">{{filterNull(item2.logs).createtime}}</p>
                            </div>
                            <p class="weui-media-box__desc">{{filterNull(item2.logs).description}}</p>
                            <div class="exp uploaderFiles" style="display: inline-block;padding-top: 5px;" v-if="item2.logs != null && getImgType(item2.logs.imgs).length > 0">
                              <img class="logimg" style="padding-right: 5px;"  v-for="(image, index) in getImgType(item2.logs.imgs)" :key="image.guid"  alt="" onerror="javascript:this.src='../../../static/image/default.png';this.onerror = null" :src="image.url + '-suolue.png'" :data-img="image.url + '.png'" />
                            </div>
                          </div>
                        </a>
                      </template>
                    </template>

<!--                  </template>-->
<!--                </template>-->
              </div>
            </div>

        </template>
        <!--1-->
        <template v-else>
          <div class="weui-form-preview">
            <div class="weui-form-preview__bd">
              <a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">
                <div class="weui-media-box__hd" style="overflow: hidden;">
                  <div class="nodenm"  :class="item.status != 1 ? 'blue' : ''">{{item.name}}</div>
                </div>
                <div class="weui-media-box__bd" style="position: relative;">
                  <div class="delsty" v-show="showDiscuss && item.status == 1" @click="editIt(item.optlogid)"><img src="@/assets/icon-msg.png" style="width: 20px;" /> </div>
                  <div class="icontbox">
                    <h4 class="weui-media-box__title contbox-h4">{{(itemOperators(item.operators).length > 0 ? itemOperators(item.operators)[0] : {}).realname}}</h4>
<!--                    <h4 class="weui-media-box__title contbox-h4" v-if="itemOperators(item.operators).length <= 1" v-for="(oper, i) in itemOperators(item.operators)">{{oper.realname}}</h4>-->
<!--                    <h4 class="weui-media-box__title contbox-h4" v-if="itemOperators(item.operators).length > 1"><span v-for="(oper2, i) in itemOperators(item.operators)">{{oper2.realname}}<i v-show="i+1 != itemOperators(item.operators).length"> / </i></span></h4>-->
                    <p class="contbox-txt">{{filterNull(item.logs).createtime}}</p>
                  </div>
                  <p class="weui-media-box__desc" style="color: #333;">
                    {{filterNull(item.logs).description}}
<!--                    <span v-show="showDiscuss && item.status == 1" @click="editIt(item.optlogid)"><img src="@/assets/icon-msg.png" style="width: 12px;margin-left: 3px;" /> </span>-->
                  </p>
                  <div class="exp uploaderFiles" style="display: inline-block;padding-top: 5px;" v-if="item.logs != null && getImgType(item.logs.imgs).length > 0">
                    <img class="logimg" style="padding-right: 5px;"  v-for="(image, index) in getImgType(item.logs.imgs)" :key="image.guid"  alt="" onerror="javascript:this.src='../../../static/image/default.png';this.onerror = null" :src="image.url + '-suolue.png'" :data-img="image.url + '.png'" />
                  </div>
                  <div v-if="item.logs != null" style="background: #fafafa;padding: 0 5px;">
                    <template v-for="mesg in item.logs.logs">
                      <div style="font-size: 12px; color: #999;overflow: auto;">
                        <span style="color:#006699;">{{mesg.replyer}}：</span>
                        <span style="display: inline-block;line-height: 18px;">{{mesg.content}}</span>
                        <span v-if="getImgType(mesg.imgs).length == 0" style="float: right; padding-left: 5px;">{{mesg.replyTime}}</span>
<!--                        <span v-show="showDiscuss && item.status == 1" @click="editIt(item.optlogid, mesg.id)"><img src="@/assets/icon-msg.png" style="width: 12px;margin-left: 3px;" /> </span>-->
                      </div>
                      <div class="exp uploaderFiles" style="display: inline-block; overflow: auto;" v-if="getImgType(mesg.imgs).length > 0">
                        <img class="logimg" style="padding-right: 5px;"  v-for="(image, index) in getImgType(mesg.imgs)" :key="image.guid"  alt="" onerror="javascript:this.src='../../../static/image/default.png';this.onerror = null" :src="image.url + '-suolue.png'" :data-img="image.url + '.png'" />
                        <span style="float: right; padding-left: 5px;">{{mesg.replyTime}}</span>
                      </div>
                    </template>
                  </div>
                </div>
              </a>
            </div>
          </div>
        </template>
      </template>
      <div class="weui-loadmore weui-loadmore_line">
        <span class="weui-loadmore__tips">没有更多了</span>
      </div>
    </div>
    <OperationLogs v-if="sellformpid != undefined" :orderid="sellformpid" :srguid="srguid" :departid="departid" :ordercode="sellformpcode"></OperationLogs>
    <div class="weui-loadmore" v-if="loading">
      <i class="weui-loading"></i>
      <span class="weui-loadmore__tips">正在加载</span>
    </div>
    <div v-show="!loading && nodes.length <= 0 && sellformpid == undefined" class="datalist nodata" v-else>没有审批记录哦~</div>

    <modal name="remarkLayer" width="90%" height="435" styles="overflow-y: auto;">
      <div class="weui-cells weui-cells_form">
        <form method="post" id="formid">
          <div class="cellgroup">
            <div class="weui-cell" style="padding: 10px 0;">
              <div class="weui-cell__hd"><label class="weui-label">附件上传</label></div>
              <div class="weui-cell__ft" style="margin-left: 12px;">
                <div class="weui_uploader_bd"><ul class="weui_uploader_files"></ul><div class="weui_uploader_input_wrp inrow"><input type="button" @click="wxUoloadImage" ref="selectImage2" id="selectImage2"  class="weui_uploader_input" ></div></div>
              </div>
              <ul class="weui_uploader_files" id="images2" style="font-size: 0; margin-left: 5px;">
                <li class="weui-uploader_file inrow" v-for="(img, index) in images2.serverId" :id="img"  @click=del(img,2) ><img :src="images2.srcStr[index]" width="30" style="max-height: 30px;"/></li>
              </ul>
            </div>
            <div class="weui-cell" style="padding: 10px 0;align-items: baseline;">
              <div class="weui-cell__hd">
                <label class="weui-label">评论内容</label>
              </div>
              <div class="weui-cell__bd">
                <textarea id="remark" class="weui-textarea" name="" placeholder="请输评论内容" rows="11"></textarea>
              </div>
            </div>
          </div>
          <div class="weui-btn-area">
            <a class="weui-btn weui-btn_primary subbtn" href="javascript:" @click="submitAppendRm">确定</a>
          </div>
        </form>
      </div>
    </modal>

    <div class="paylayer" v-show="nodes.length > 0">
      <div class="weui-form-preview__ft">
        <a class="weui-form-preview__btn weui-form-preview__btn_primary" @click="showDiscuss = !showDiscuss" href="javascript:">{{showDiscuss ? "取消" : "评论"}}</a>
      </div>
    </div>
  </div>
</template>

<script>
  import wx from 'weixin-js-sdk'
  import OperationLogs from '../common/OperationLogs'

  export default {
    name: 'SalesOperationLogs3',
    data () {
      return {
        nodes: [],
        currNode: {},
        orderid: '',
        srguid: '',
        departid: '',
        sellformpid: '',
        sellformpcode: '',
        nodesHtml: '',
        userid: localStorage.userid,
        username: localStorage.username,
        loading: true,
        wxParams: {},
        images2: {
          serverId: [],
          srcStr: [],
        },
        tempnode: '',
        pendNodes: [],
        tempChildnode: '',
        showDiscuss: false
      }
    },
    components: {
      OperationLogs
    },
    mounted() {
      this.orderid = this.$route.query.orderid;
      this.srguid = this.$route.query.srguid;
      this.departid = this.$route.query.departid;
      this.sellformpid = this.$route.query.sellformpid;
      this.sellformpcode = this.$route.query.sellformpcode;

      this.getOperatelogs();
      this.getWxparams(this);

      $('#wrap').on('click', '.logimg', function () {
        let num = $(this).parent().children().length;
        let imgArr = [];
        for (var i=0; i<num; i++) {
          imgArr.push($(this).parent().find('.logimg').eq(i).data('img'));
        }
        let index = $(this).index();
        let pb3 = $.photoBrowser({
          items: imgArr,
          initIndex: index
        });
        pb3.open();
      });

    },
    watch: {
      // 'orderid': function (val) {
      //   this.getOperatelogs();
      // },
      // 'srguid': function (val) {
      //   this.getOperatelogs();
      // },
      // 'departid': function (val) {
      //   console.log('departid:', this.departid)
      //   this.getOperatelogs();
      // },
    },
    methods: {
      itemOperators: function(opers) {
        return opers || [];
      },
      openNode: function(node) {
        this.currNode = node;
      },
      getWxparams: function(that) {
        this.axios({
          method: 'post',
          url: '/sales/Operationlogs!getUpImagInfo.action',
          params: {url: location.href.split("#")[0]}
        }).then(response => {
          if (response.status == 200) {
            let wxParams = response.data.params;
            //配置微信公众号参数
            this.wxConfig(response.data.params);
            //上传
            //this.wxUoloadImage(this);

          } else {
            this.toastError('系统错误：' + response.data.msg);
          }
        });
      },
      wxConfig: function(wxParams) {
        wx.config({
          debug: false,            // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
          appId: wxParams.appid,    // 必填，公众号的唯一标识
          timestamp: wxParams.timestamp,  // 必填，生成签名的时间戳
          nonceStr: wxParams.nonceStr, // 必填，生成签名的随机串
          signature: wxParams.signature,// 必填，签名
          jsApiList: ['scanQRCode', 'chooseImage', 'uploadImage'] // 必填，需要使用的JS接口列表
        });
      },
      wxUoloadImage: function(that) {
        let cthis = this;
        wx.chooseImage({
          success: function (res) {
            $(function(){
              $.each( res.localIds, function(i, n){
                wx.uploadImage({
                  localId: n,
                  isShowProgressTips: 1,
                  success: function (res) {
                    if (cthis.checkCore() == 'ios') {
                      wx.getLocalImgData({
                        localId: n, // 图片的localID
                        success: function (res2) {
                          cthis.$nextTick(function () {
                            cthis.images2.srcStr.push(res2.localData);
                          })
                        }
                      });
                    } else {
                      cthis.$nextTick(function () {
                        cthis.images2.srcStr.push(n);
                      })
                    }
                    cthis.images2.serverId.push(res.serverId);
                  },
                  fail: function (res) {
                    $.alert(JSON.stringify(res));
                  }
                });
              });
            });
          }
        });
        // };
        //});

      },
      del: function (id, index){
        let cthis = this;
        $.actions({
          actions: [{
            text: "删除",
            onClick: function() {
              $.confirm("确定删除?", function() {
                //点击确认后的回调函数
                //删掉id
                var ids = cthis['images' + index].serverId;
                var a =  ids.indexOf(id);
                cthis.$nextTick(function () {
                  cthis['images' + index].serverId.splice(a,1);
                  cthis['images' + index].srcStr.splice(a,1);
                })
              }, function() {
                //点击取消后的回调函数
              });
            }
          }
          ]
        });
      },
      checkCore:function() {
        var u = navigator.userAgent;
        //var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1;//g
        var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);   //ios终端
        if (isIOS) {
          return 'ios';
        } else  {
          return 'android';
        }
      },
      editIt: function(id, tempChildid = ""){
        this.tempnode = id;
        this.tempChildnode = tempChildid;
        this.$modal.show('remarkLayer');
      },
      closeModal: function() {
        this.$modal.hide('remarkLayer');
      },
      submitAppendRm: function() {
        let that = this;
        if ($('#remark').val() == '') {
          that.toastText('请输入评论内容！');
          return false;
        }
        //防止重复提交
        $('.subbtn').attr("disabled",true).css("pointer-events","none");
        //显示提交状态
        $.showLoading("正在提交");

        let postData = {
          operationId: this.tempnode,
          content: $('#remark').val(),
          imageids: this.images2.serverId.join(',')
        }
        if (this.tempChildnode != '') {
          postData.opltId = this.tempChildnode;
        }
        that.axios({
          method: 'post',
          url: '/sales/OprationLog!reply.action',
          params: postData
        }).then(response => {
          //恢复提交按钮可点击
          $('.subbtn').attr('disabled', false).css("pointer-events","auto");
          //关闭提交状态
          $.hideLoading();
          //关闭当前modal
          this.$modal.hide('remarkLayer');

          if (response.data.msg == 'success') {
            that.toastSuccess("保存成功");
            $.closeModal();
            location.reload();
          } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
            //不不设置提示
          } else {
            that.toastError('系统错误');
          }
        }).catch(function (error) {
          //关闭当前modal
          this.$modal.hide('remarkLayer');
          //恢复提交按钮可点击
          $('.subbtn').attr('disabled', false).css("pointer-events","auto");
          //关闭提交状态
          $.hideLoading();
          that.toastError('系统错误');
        });
      },
      getOperatelogs: function (id) {
        if (this.orderid == undefined || this.srguid == undefined || this.departid == undefined) return;
        this.axios({
          method: 'get',
          url: '/sales/Flowprocess!getNodes.action',
          params: {orderid: this.orderid, srguid: this.srguid, departid: this.departid, flowid: 99}
        }).then(response => {
          if (response.data.msg == 'success') {
            this.loading = false;

            let data = response.data;
            this.nodes = data.nodes;
            this.pendNodes = this.nodes.filter(item => {
              return item.status == 2;
            })

            this.$nextTick(() => {
              $('.weui-cell_swiped').swipeout();

              $('.anode').click(function () {
                $(this).parents('.weui-cell_swiped').swipeout('open');
              })
              $('.close-swipeout').click(function () {
                $(this).parents('.weui-cell_swiped').swipeout('close');
              })
            })

          } else {
            //this.toastText('获取审批记录失败');
          }
        });
      },
      showEdit: function(opers, status) {
        opers = opers || [];
        let operIds = opers.map(item => {
          return item.guid;
        });
        return operIds.indexOf(this.userid) > -1 && status == 1;
      },
      packIt: function(obj) {
        if (obj != '' && obj != undefined) {
          return JSON.parse(obj);
        } else {
          return [];
        }
      },
      filterNull: function (obj) {
        return obj != null ? obj : {};
      },
      openLogs: function() {
        this.$router.push({name: 'OperationLogs2', query: {orderid: this.id, srguid: this.sellform.storermguid, departid: this.sellform.depguid}});
      },
      getImgType: function (imgs, type = '') {
        return imgs.filter(item =>{
          return item.imagetype == type;
        })
      }
    }
  }
</script>
